package com.example.famhealing.schedule;

import java.util.ArrayList;

import com.example.famhealing.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
 
public class DiagnoseListAdapter extends ArrayAdapter<Diagnose_List_Data> {
 
    private ArrayList<Diagnose_List_Data> items;
 
    public DiagnoseListAdapter(Context context, int textViewResourceId,
            ArrayList<Diagnose_List_Data> items) {
        super(context, textViewResourceId, items);
        this.items = items; }
 
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;
        if (v == null) {
            
            LayoutInflater vi = (LayoutInflater) getContext().getSystemService(
                    Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.diagnose_list, null);
        }
        Diagnose_List_Data diagnose_list_data = items.get(position);
 
        if (diagnose_list_data != null) {
            //하나의 이미지뷰와 2개의 텍스트뷰 정보를 받아온다.
            TextView tv_date = (TextView) v.findViewById(R.id.date);
            TextView tv_time = (TextView) v.findViewById(R.id.time);
            TextView tv_category = (TextView) v.findViewById(R.id.category);
            TextView tv_location = (TextView) v.findViewById(R.id.location);
            
            // 현재 item의 position에 맞는 이미지와 글을 넣어준다.         
            
            tv_date.setText(diagnose_list_data.getDiagnoseDate());
            tv_time.setText(diagnose_list_data.getDiagnoseTime());
            tv_category.setText(diagnose_list_data.getDiagnoseCategory());
            tv_location.setText(diagnose_list_data.getDiagnoseLocation());
            
        }
 
        return v;
    }
}
 
class Diagnose_List_Data {
    private String diagnoseDate;
    private String diagnoseTime;
    private String diagnoseCategory;
    private String diagnoseLocation;
 
    public Diagnose_List_Data(String diagnoseDate, String diagnoseTime
    		, String diagnoseCategory, String diagnoseLocation) {
        this.setDiagnoseDate(diagnoseDate);
        this.setDiagnoseTime(diagnoseTime);
        this.setDiagnoseCategory(diagnoseCategory);
        this.setDiagnoseLocation(diagnoseLocation);
    }
 
    public String getDiagnoseDate() {
        return diagnoseDate;
    }
 
    public void setDiagnoseDate(String diagnoseDate) {
        this.diagnoseDate = diagnoseDate;
    }
 
    public String getDiagnoseTime() {
        return diagnoseTime;
    }
 
    public void setDiagnoseTime(String diagnoseTime) {
        this.diagnoseTime = diagnoseTime;
    }
    
    public String getDiagnoseCategory() {
        return diagnoseCategory;
    }
 
    public void setDiagnoseCategory(String diagnoseCategory) {
        this.diagnoseCategory = diagnoseCategory;
    }
    
    public String getDiagnoseLocation() {
        return diagnoseLocation;
    }
 
    public void setDiagnoseLocation(String diagnoseLocation) {
        this.diagnoseLocation = diagnoseLocation;
    }
    
}